package kr.saeildamil.androidstudy_second.br_service;

import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Messenger;
import android.widget.Toast;

public class MessengerService extends Service {
	static final int MSG_SAY_HELLO = 1;
	@Override
	public IBinder onBind(Intent intent) {
		return mMessenger.getBinder();
	}
	
	Messenger mMessenger = new Messenger(new Handler(){
		public void handleMessage(android.os.Message msg) {
			switch(msg.what){
			case MSG_SAY_HELLO:
				Toast.makeText(getApplication(), "hello!", Toast.LENGTH_SHORT).show();
				break;
			default:
				super.handleMessage(msg);
					
			}
		};
	});

}
